home *** CD-ROM | disk | FTP | other *** search
/ Gamers Delight 2 / Gamers Delight 2.iso / Aminet / game / role / Ang261Lib.lha / src / types.h < prev    next >
C/C++ Source or Header  |  1994-10-22  |  16KB  |  425 lines

  1. /* types.h: global type declarations
  2.  
  3.    Copyright (c) 1989 James E. Wilson, Robert A. Koeneke
  4.  
  5.    This software may be copied and distributed for educational, research, and
  6.    not for profit purposes provided that this copyright and statement are
  7.    included in all such copies. */
  8. #if !defined(__alpha)
  9. typedef unsigned long  int32u;
  10. typedef long           int32;
  11. #else
  12. typedef unsigned int   int32u;
  13. typedef int            int32;
  14. #endif
  15. typedef unsigned short int16u;
  16. typedef short           int16;
  17. typedef unsigned char  int8u;
  18. /* some machines will not accept 'signed char' as a type, and some accept it
  19.    but still treat it like an unsigned character, let's just avoid it,
  20.    any variable which can ever hold a negative value must be 16 or 32 bits */
  21.  
  22. #define VTYPESIZ    160
  23. #define BIGVTYPESIZ 300
  24. typedef char vtype[VTYPESIZ];
  25. /* note that since its output can easily exceed 80 characters, objdes must
  26.    always be called with a bigvtype as the first paramter */
  27. typedef char bigvtype[BIGVTYPESIZ];
  28. typedef char stat_type[8];
  29.  
  30. /* Many of the character fields used to be fixed length, which greatly
  31.    increased the size of the executable.  I have replaced many fixed
  32.    length fields with variable length ones. */
  33.  
  34. /* all fields are given the smallest possbile type, and all fields are
  35.    aligned within the structure to their natural size boundary, so that
  36.    the structures contain no padding and are minimum size */
  37.  
  38. /* bit fields are only used where they would cause a large reduction in
  39.    data size, they should not be used otherwise because their use
  40.    results in larger and slower code */
  41.  
  42. typedef int16u attid;
  43.  
  44. typedef struct creature_type
  45. {
  46.   const char *name;            /* Descrip of creature    */
  47.   int32u cmove;                /* Bit field          */
  48.   int32u spells;            /* Creature spells          */
  49.   int32u cdefense;            /* Bit field          */
  50.   int32u spells2;            /* More creature spells   */
  51.   int32u spells3;            /* Yes! even More creature spells */
  52.   int32u mexp;                /* Exp value for kill     */
  53.   int16u sleep;                /* Inactive counter/10    */
  54.   int8u aaf;                /* Area affect radius     */
  55.   int16u ac;                /* AC              */
  56.   int8u speed;                /* Movement speed+10      */
  57.   int8u cchar;                /* Character rep.          */
  58.   int8u hd[2];                /* Creatures hit die      */
  59.   attid damage[4];            /* Type attack and damage */
  60.   int16u level;                /* Level of creature      */
  61.   int8u rarity;                /* Rarity of creature     */
  62.   char gender;                /* one of 'm','f','n','p' to genderize monsters -CWS */
  63. } creature_type;
  64.  
  65. typedef struct m_attack_type        /* Monster attack and damage types */
  66.   {
  67.     int8u attack_type;            
  68.     int8u attack_desc;
  69.     int8u attack_dice;
  70.     int8u attack_sides;
  71.   } m_attack_type;
  72.  
  73. typedef struct recall_type        /* Monster memories. -CJS- */
  74.   {
  75.     int32u r_cmove;
  76.     int32u r_spells;
  77.     int32u r_spells2;
  78.     int32u r_spells3;
  79.     int16u r_kills, r_deaths;
  80.     int32u r_cdefense;
  81.     int8u r_wake, r_ignore;
  82.     int8u r_attacks[MAX_MON_NATTACK];
  83.   } recall_type;
  84.  
  85. struct unique_mon {
  86.   int32 exist;
  87.   int32 dead;
  88. };
  89.  
  90. typedef struct describe_mon_type {
  91.   const char *name;
  92.   const char *desc;
  93.   char gender;                /* one of 'm','f','n','p' to genderize monsters -CWS */
  94. } describe_mon_type;
  95.  
  96. typedef struct monster_type
  97. {
  98.   int16 hp;                /* Hit points        */
  99.   int16 maxhp;                /* Max Hit points        */
  100.   int16 csleep;                /* Inactive counter        */
  101.   int16 cspeed;                /* Movement speed        */
  102.   int16u mptr;                /* Pointer into creature was int16u       */
  103.   /* Note: fy, fx, and cdis constrain dungeon size to less than 256 by 256 */
  104.   int8u fy;                /* Y Pointer into map    */
  105.   int8u fx;                /* X Pointer into map    */
  106.   int8u cdis;                /* Cur dis from player    */
  107.   int8u ml;
  108.   int8u stunned;
  109.   int8u confused;
  110.   int8u monfear;            /* Run away! Run away! -DGK */
  111. } monster_type;
  112.  
  113. typedef struct treasure_type
  114. {
  115.   const char *name;            /* Object name              */
  116.   int32u flags;                /* Special flags              */
  117.   int8u tval;                /* Category number              */
  118.   int8u tchar;                /* Character representation          */
  119.   int16 p1;                /* Misc. use variable          */
  120.   int32 cost;                /* Cost of item              */
  121.   int8u subval;                /* Sub-category number          */
  122.   int8u number;                /* Number of items              */
  123.   int16u weight;            /* Weight                  */
  124.   int16 tohit;                /* Plusses to hit              */
  125.   int16 todam;                /* Plusses to damage          */
  126.   int16 ac;                /* Normal AC              */
  127.   int16 toac;                /* Plusses to AC              */
  128.   int8u damage[2];            /* Damage when hits              */
  129.   int8u level;                /* Level item first found          */
  130.   int8u rare;                /* True if Rare              */
  131.   int32u flags2;            /* Yes! even more froggin' flags! */
  132. } treasure_type;
  133.  
  134. /* only damage, ac, and tchar are constant; level could possibly be made
  135.    constant by changing index instead; all are used rarely */
  136. /* extra fields x and y for location in dungeon would simplify pusht() */
  137. /* making inscrip a pointer and mallocing space does not work, there are
  138.    two many places where inven_types are copied, which results in dangling
  139.    pointers, so we use a char array for them instead */
  140. #define INSCRIP_SIZE 13     /* notice alignment, must be 4*x + 1 */
  141. typedef struct inven_type
  142. {
  143.   int16u index;                /* Index to object_list    */
  144.   int8u name2;                /* Object special name    */
  145.   char inscrip[INSCRIP_SIZE];        /* Object inscription    */
  146.   int32u flags;                /* Special flags        */
  147.   int8u tval;                /* Category number        */
  148.   int8u tchar;                /* Character representation */
  149.   int16 p1;                /* Misc. use variable    */
  150.   int32 cost;                /* Cost of item        */
  151.   int8u subval;                /* Sub-category number    */
  152.   int8u number;                /* Number of items        */
  153.   int16u weight;            /* Weight            */
  154.   int16 tohit;                /* Plusses to hit        */
  155.   int16 todam;                /* Plusses to damage    */
  156.   int16 ac;                /* Normal AC        */
  157.   int16 toac;                /* Plusses to AC        */
  158.   int8u damage[2];            /* Damage when hits        */
  159.   int8u level;                /* Level item first found    */
  160.   int8u ident;                /* Identify information    */
  161.   int32u flags2;            /* Yes! even more froggin' flags!            */
  162.   int16u timeout;            /* How long to wait before reactivating an Artifact */
  163. } inven_type;
  164.  
  165.  
  166. typedef struct player_type
  167. {
  168.   struct misc
  169.     {
  170.       char name[27];            /* Character name    */
  171.       int8u male;            /* Sex of character */
  172.       int32 au;                /* Gold        */
  173.       int32 max_exp;            /* Max experience    */
  174.       int32 exp;            /* Cur experience    */
  175.       int16u exp_frac;            /* Cur exp fraction * 2^16    */
  176.       int16u age;            /* Characters age    */
  177.       int16u ht;            /* Height        */
  178.       int16u wt;            /* Weight        */
  179.       int16u lev;            /* Level        */
  180.       int16u max_dlv;            /* Max level explored    */
  181.       int16 srh;            /* Chance in search */
  182.       int16 fos;            /* Frenq of search    */
  183.       int16 bth;            /* Base to hit    */
  184.       int16 bthb;            /* BTH with bows    */
  185.       int16 mana;            /* Mana points    */
  186.       int16 mhp;            /* Max hit pts    */
  187.       int16 ptohit;            /* Plusses to hit    */
  188.       int16 ptodam;            /* Plusses to dam    */
  189.       int16 pac;            /* Total AC        */
  190.       int16 ptoac;            /* Magical AC    */
  191.       int16 dis_th;            /* Display +ToHit    */
  192.       int16 dis_td;            /* Display +ToDam    */
  193.       int16 dis_ac;            /* Display +ToAC    */
  194.       int16 dis_tac;            /* Display +ToTAC    */
  195.       int16 disarm;            /* % to Disarm    */
  196.       int16 save;            /* Saving throw    */
  197.       int16 sc;                /* Social Class    */
  198.       int16 stl;            /* Stealth factor    */
  199.       int8u pclass;            /* # of class    */
  200.       int8u prace;            /* # of race    */
  201.       int8u hitdie;            /* Char hit die    */
  202.       int8u expfact;            /* Experience factor    */
  203.       int16 cmana;            /* Cur mana pts        */
  204.       int16u cmana_frac;        /* Cur mana fraction * 2^16 */
  205.       int16 chp;            /* Cur hit pts        */
  206.       int16u chp_frac;            /* Cur hit fraction * 2^16    */
  207.       char history[4][60];        /* History record        */
  208.     } misc;
  209.  
  210. /* Stats now kept in arrays, for more efficient access. -CJS- */
  211.   struct stats
  212.     {
  213.       int16u max_stat[6];        /* What is restored            */
  214.       int8u cur_stat[6];        /* What is natural            */
  215.       int16 mod_stat[6];        /* What is modified, may be +/- */
  216.       int16u use_stat[6];        /* What is used            */
  217.     } stats;
  218.   struct flags
  219.     {
  220.       int32u status;            /* Status of player       */
  221.       int16 rest;            /* Rest counter       */
  222.       int16 blind;            /* Blindness counter   */
  223.       int16 paralysis;            /* Paralysis counter   */
  224.       int16 confused;            /* Confusion counter   */
  225.       int16 food;            /* Food counter       */
  226.       int16 food_digested;        /* Food per round       */
  227.       int16 protection;            /* Protection fr. evil */
  228.       int16 speed;            /* Cur speed adjust       */
  229.       int16 fast;            /* Temp speed change   */
  230.       int16 slow;            /* Temp speed change   */
  231.       int16 afraid;            /* Fear           */
  232.       int16 cut;            /* Wounds           */
  233.       int16 stun;            /* Stunned player       */
  234.       int16 poisoned;            /* Poisoned           */
  235.       int16 image;            /* Hallucinate       */
  236.       int16 protevil;            /* Protect VS evil       */
  237.       int16 invuln;            /* Increases AC       */
  238.       int16 hero;            /* Heroism           */
  239.       int16 shero;            /* Super Heroism       */
  240.       int16 shield;            /* Shield Spell       */
  241.       int16 blessed;            /* Blessed           */
  242.       int16 resist_heat;        /* Timed heat resist   */
  243.       int16 resist_cold;        /* Timed cold resist   */
  244.       int16 resist_acid;        /* Timed acid resist   */
  245.       int16 resist_light;        /* Timed light resist  */
  246.       int16 resist_poison;        /* Timed poison resist */
  247.       int16 detect_inv;            /* Timed see invisible */
  248.       int16 word_recall;        /* Timed teleport level*/
  249.       int16 see_infra;            /* See warm creatures  */
  250.       int16 tim_infra;            /* Timed infra vision  */
  251.       int8u see_inv;            /* Can see invisible   */
  252.       int8u teleport;            /* Random teleportation*/
  253.       int8u free_act;            /* Never paralyzed       */
  254.       int8u slow_digest;        /* Lower food needs       */
  255.       int8u aggravate;            /* Aggravate monsters  */
  256.       int8u fire_resist;        /* Resistance to fire  */
  257.       int8u cold_resist;        /* Resistance to cold  */
  258.       int8u acid_resist;        /* Resistance to acid  */
  259.       int8u regenerate;            /* Regenerate hit pts  */
  260.       int8u lght_resist;        /* Resistance to light */
  261.       int8u ffall;            /* No damage falling   */
  262.       int8u sustain_str;        /* Keep strength       */
  263.       int8u sustain_int;        /* Keep intelligence   */
  264.       int8u sustain_wis;        /* Keep wisdom       */
  265.       int8u sustain_con;        /* Keep constitution   */
  266.       int8u sustain_dex;        /* Keep dexterity       */
  267.       int8u sustain_chr;        /* Keep charisma       */
  268.       int8u confuse_monster;        /* Glowing hands.       */
  269.       int8u new_spells;            /* Number of spells can learn. */
  270.       int8u poison_resist;        /* Resistance to poison       */
  271.       int8u hold_life;            /* Immune to life draining       */
  272.       int8u telepathy;            /* Gives telepathy       */
  273.       int8u fire_im;            /* Immune to fire       */
  274.       int8u acid_im;            /* Immune to acid       */
  275.       int8u poison_im;            /* Immune to poison       */
  276.       int8u cold_im;            /* Immune to cold       */
  277.       int8u light_im;            /* Immune to lightning */
  278.       int8u light;            /* Permanent light       */
  279.       int8u confusion_resist;        /* Resist confusion       */
  280.       int8u sound_resist;        /* Resist sound       */
  281.       int8u light_resist;        /* Resist light       */
  282.       int8u dark_resist;        /* Resist darkness       */
  283.       int8u chaos_resist;        /* Resist chaos       */
  284.       int8u disenchant_resist;        /* Resist disenchant   */
  285.       int8u shards_resist;        /* Resist shards       */
  286.       int8u nexus_resist;        /* Resist nexus       */
  287.       int8u blindness_resist;        /* Resist blindness       */
  288.       int8u nether_resist;        /* Resist nether       */
  289.       int8u fear_resist;        /* Resist fear       */
  290.     } flags;
  291. } player_type;
  292.  
  293.  
  294. typedef struct spell_type
  295. {  /* spell name is stored in spell_names[] array at index i, +31 if priest */
  296.   int8u slevel;
  297.   int8u smana;
  298.   int8u sfail;
  299.   int16u sexp;                /* 1/4 of exp gained for learning spell */
  300. } spell_type;
  301.  
  302.  
  303. typedef struct race_type
  304. {
  305.   const char    *trace;            /* Type of race        */
  306.   int16 str_adj;            /* adjustments        */
  307.   int16 int_adj;            
  308.   int16 wis_adj;
  309.   int16 dex_adj;
  310.   int16 con_adj;
  311.   int16 chr_adj;
  312.   int8u b_age;                /* Base age of character     */
  313.   int8u m_age;                /* Maximum age of character     */
  314.   int8u m_b_ht;                /* base height for males     */
  315.   int8u m_m_ht;                /* mod height for males     */
  316.   int8u m_b_wt;                /* base weight for males     */
  317.   int8u m_m_wt;                /* mod weight for males     */
  318.   int8u f_b_ht;                /* base height females     */
  319.   int8u f_m_ht;                /* mod height for females     */
  320.   int8u f_b_wt;                /* base weight for female     */
  321.   int8u f_m_wt;                /* mod weight for females     */
  322.   int16 b_dis;                /* base chance to disarm     */
  323.   int16 srh;                /* base chance for search     */
  324.   int16 stl;                /* Stealth of character     */
  325.   int16 fos;                /* frequency of auto search     */
  326.   int16 bth;                /* adj base chance to hit     */
  327.   int16 bthb;                /* adj base to hit with bows */
  328.   int16 bsav;                /* Race base for saving throw*/
  329.   int8u bhitdie;            /* Base hit points for race     */
  330.   int8u infra;                /* See infra-red         */
  331.   int8u b_exp;                /* Base experience factor     */
  332.   int8u rtclass;            /* Bit field for class types */
  333. } race_type;
  334.  
  335. typedef struct class_type
  336. {
  337.   const char *title;            /* type of class               */
  338.   int8u adj_hd;                /* Adjust hit points           */
  339.   int8u mdis;                /* mod disarming traps           */
  340.   int8u msrh;                /* modifier to searching           */
  341.   int8u mstl;                /* modifier to stealth           */
  342.   int8u mfos;                /* modifier to freq-of-search      */
  343.   int8u mbth;                /* modifier to base to hit           */
  344.   int8u mbthb;                /* modifier to base to hit - bows  */
  345.   int8u msav;                /* Class modifier to save           */
  346.   int16 madj_str;            /* Class modifier for strength     */
  347.   int16 madj_int;            /* Class modifier for intelligence */
  348.   int16 madj_wis;            /* Class modifier for wisdom       */
  349.   int16 madj_dex;            /* Class modifier for dexterity    */
  350.   int16 madj_con;            /* Class modifier for constitution */
  351.   int16 madj_chr;            /* Class modifier for charisma     */
  352.   int8u spell;                /* class use mage spells           */
  353.   int8u m_exp;                /* Class experience factor           */
  354.   int8u first_spell_lev;        /* First level where class can use spells.           */
  355.   int8u age_adj;            /* %age, warrior =100, so diff classes age faster. */
  356. } class_type;
  357.  
  358. typedef struct background_type
  359. {
  360.   const char *info;            /* History information        */
  361.   int8u roll;                /* Die roll needed for history  */
  362.   int8u chart;                /* Table number            */
  363.   int8u next;                /* Pointer to next table        */
  364.   int8u bonus;                /* Bonus to the Social Class+50 */
  365. } background_type;
  366.  
  367. typedef struct cave_type
  368. {
  369.   int16u cptr;
  370.   int16u tptr;
  371.   int8u fval;
  372.   unsigned int lr : 1;            /* room should be lit with perm light, walls with
  373.                        this set should be perm lit after tunneled out     */
  374.  
  375.   unsigned int fm : 1;            /* field mark, used for traps/doors/stairs, object is
  376.                        hidden if fm is FALSE                 */
  377.  
  378.   unsigned int pl : 1;            /* permanent light, used for walls and lighted rooms */
  379.   unsigned int tl : 1;            /* temporary light, used for player's lamp light,etc.*/
  380. } cave_type;
  381.  
  382. typedef struct owner_type
  383. {
  384.   const char *owner_name;
  385.   int16 max_cost;
  386.   int8u max_inflate;
  387.   int8u min_inflate;
  388.   int8u haggle_per;
  389.   int8u owner_race;
  390.   int8u insult_max;
  391. } owner_type;
  392.  
  393. typedef struct inven_record
  394. {
  395.   int32 scost;
  396.   inven_type sitem;
  397. } inven_record;
  398.  
  399. typedef struct store_type
  400. {
  401.   int32 store_open;
  402.   int16 insult_cur;
  403.   int8u owner;
  404.   int8u store_ctr;
  405.   int16u good_buy;
  406.   int16u bad_buy;
  407.   inven_record store_inven[STORE_INVEN_MAX];
  408. } store_type;
  409.  
  410. typedef struct high_scores
  411. {
  412.   int32 points;
  413.   int16u lev;
  414.   int16u max_lev;
  415.   int16 mhp;
  416.   int16 chp;
  417.   int16 uid;
  418.   int16 dun_level;
  419.   int8u sex;
  420.   vtype name;
  421.   vtype died_from;
  422.   int8u pclass;
  423.   int8u prace;
  424. } high_scores;
  425.